﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using PloobsEngine.Publishers;
using PloobsEngine.MessageSystem;
using PloobsEngine.Events;
using PloobsEngine.Light;
using PloobsEngine.Material;
using PloobsEngine.Modelo;
using PloobsEngine.Physics;
using PloobsEngine.Behaviors;
using PloobsEngine.IA;
using PloobsEngine.Cameras;


namespace PloobsEngine.SceneControl
{
    public delegate void BeingRemoved(IObject obj);
    public delegate void OnUpdate(IObject obj);
    public delegate void OnRecieveMessage(IObject Reciever , Message mes);
    public delegate void OnHasMoved(IObject Reciever);
        

    public interface IObject : ITalkToComponentObserver, IRecieveMessageEntity, IHaveEventManager 
    {
        event OnRecieveMessage OnRecieveMessage;
        void Serialize(System.Xml.XmlTextWriter textWriter);
        void DeSerialize(System.Xml.XmlNode node,EngineStuff engine,IWorld world);        
        IPhysicObject PhysicObject { set; get; }
        IModelo Modelo { set; get; }
        IBehaviors Behavior { set; get; }
        IMaterial Material { set; get; }
        bool hasChanged {get;}
        void PreDrawn(IWorld world, GameTime gt, ICamera cam, IList<ILight> lights, IRenderHelper render);
        void Drawn(GameTime gt ,ICamera cam ,IList<ILight> lights,IRenderHelper render);
        void PosDrawn(GameTime gt, ICamera cam, IList<ILight> lights, IRenderHelper render);
        void UpdateObject(GameTime gt, ICamera cam, IList<ILight> luzes);
        Matrix getWorldMatrix();
        Vector3 Position { set; get; }
        Matrix Rotation { set; get; }
        Vector3 Scale { set; get; }
        String Name { set; get; }
        void AddAtachment(IObjectAtachtment obj);
        void RemoveAtachment(IObjectAtachtment obj);
        /// <summary>
        /// Called when this object is removed from the world
        /// </summary>
        event BeingRemoved OnBeingRemoved;

        /// <summary>
        /// Raised when objects moves
        /// </summary>
        event OnHasMoved OnHasMoved;
        /// <summary>
        /// Called all the time the object is updated
        /// </summary>
        event OnUpdate OnUpdate;
        /// <summary>
        /// IWorld will remove this object as soon as he can
        /// </summary>
        bool ToBeRemoved { set; get; }        
        IAgent Agente
        {
            set;
            get;
        }
        /// <summary>
        /// calculated automaticaly by the IWorld
        /// </summary>
        float CameraDistance
        {
            get;
            set;
        }
        
        
    }
}
